#include "ResourceHTCell.h"
//necessary
#include "main-tools.h"
#include "memory-tools.h"

//TODO testing
PresourceHTCell initResourceHTCell(PresourceElement _resource){
	PresourceHTCell result=(PresourceHTCell)mallocMemory(sizeof(ResourceHTCell),"ResourceHTCell.c:initResourceHTCell:1");
	result->key=_resource->name;
	result->resource=_resource;
	return result;
}

//TODO testing
void freeResourceHTCell(PresourceHTCell _resource){
	freeResourceElement(_resource->resource);
	freeMemory(sizeof(ResourceHTCell),_resource);
}

//TODO testing
void printResourceHTCell(FILE* f,PresourceHTCell pcell){
	fprintf(f,"[%s -> ",pcell->key);
	printResourceElement(f,pcell->resource);
	fprintf(f,"]");
}

//TODO testing
void generateDOTResourceHTCell(FILE *f, PresourceHTCell pcell,int* nodenumber,int* htcellnumber, int format){
	fprintf(f,"n%04d [shape=\"record\" label=\"{%s|",*nodenumber,pcell->key);
	generateDOTResourceElement(f,pcell->resource,nodenumber,htcellnumber,format);
	fprintf(f,"}\"];");

}
